package demo8;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.sql.Connection;

public class Demo {

    public static void main(String[] args) throws  Exception{
        AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(Config.class);
        Person person=context.getBean(Person.class);
        System.out.println(person);
        Student student=context.getBean(Student.class);
        System.out.println(student);
        DBUtil dbUtil=context.getBean(DBUtil.class);
        Connection connection= dbUtil.getConnection();
        System.out.println(connection);
    }
}
